home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Video
/
World of Video.iso
/
gfxprograms
/
conversion
/
pbmplus
/
doc
/
pbmmask.doc
< prev
next >
Wrap
Text File
|
1995-02-13
|
2KB
|
67 lines
pbmmask(1) PBM Plus pbmmask(1)
NAME
pbmmask - create a mask bitmap from a regular bitmap
SYNOPSIS
pbmmask [pbmfile]
DESCRIPTION
Reads a portable bitmap as input. Creates a corresponding
mask bitmap and writes it out.
The color to be interpreted as "background" is determined
automatically. Regardless of which color is background, the
mask will be white where the background is and black where
the figure is.
This lets you do a masked paste like this, for objects with
a black background:
pbmmask obj > objmask
pbmpaste < dest -and objmask <x> <y> | pbmpaste -or obj <x> <y>
For objects with a white background, you can either invert
them or add a step:
pbmmask obj > objmask
pnminvert objmask | pbmpaste -and obj 0 0 > blackback
pbmpaste < dest -and objmask <x> <y> | pbmpaste -or blackback <x> <y>
Note that this three-step version works for objects with
black backgrounds too, if you don't care about the wasted
time.
You can also use masks with graymaps and pixmaps, using the
ppmarith tool. For instance:
ppmtopgm obj.ppm | pgmtopbm -threshold | pbmmask > objmask.pbm
ppmarith -multiply dest.ppm objmask.pbm > t1.ppm
pnminvert objmask.pbm | ppmarith -multiply obj.ppm - > t2.ppm
ppmarith -add t1.ppm t2.ppm
An interesting variation on this is to pipe the mask through
the ppmsmooth script before using it. This makes the boun-
dary between the two images less sharp.
SEE ALSO
pbmpaste(1), pnminvert(1), pbm(5), ppmarith(1)
AUTHOR
Copyright (C) 1988 by Jef Poskanzer.
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting docu-
mentation. This software is provided "as is" without
express or implied warranty.
Printed 5/25/90 08 August 1989 1